import React from 'react'
import ReactDOM from 'react-dom';

import { createHistory, useBasename, createHashHistory } from 'history'
import { Router, Route ,useRouterHistory ,Redirect } from 'react-router'

import { Provider } from 'mobx-react';
import { RouterStore, syncHistoryWithStore } from 'mobx-react-router';

const routingStore = new RouterStore();

const browserHistory  = useRouterHistory(createHashHistory)({
    queryKey: '_key',
    basename: '/'
});

const history = syncHistoryWithStore(browserHistory, routingStore);
window.weaHistory = history;
import Comstore from 'comsMobx';
const ComStore = Comstore.store;
import ElementIndex from './index'
const ElementMoreRoute = ElementIndex.Route;
const ElementStore = ElementIndex.store;

let stores = {
    // Key can be whatever you want
    routing:routingStore,
    ...ComStore,
    ...ElementStore,
}
class Root extends React.Component {
    render() {
        return (
            <Provider ecId={`${this && this.props && this.props.ecId || ''}_Provider@rza2fx`} {...stores}>
                <Router ecId={`${this && this.props && this.props.ecId || ''}_Router@2ayevo`} history={history}>
                    {ElementMoreRoute}
                </Router>
            </Provider>
        )
    }
}

ReactDOM.render(<Root ecId={`${this && this.props && this.props.ecId || ''}_Root@c0ayiq`} />,document.getElementById('container'));

